package com.hogocloud.corelibrary.common.adapter.fragment


import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

/**
 * tablayout view pager
 *
 * Created by gjc on 2018-05-07.
 */
class FragmentAdapter(fm: FragmentManager, private val fragments: List<Fragment>) : FragmentPagerAdapter(fm) {

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }

    override fun getCount(): Int {
        return fragments.size
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {

    }

    override fun getPageTitle(position: Int): CharSequence? {
        return fragments[position].tag
    }

}
